package mt;

import java.util.Scanner;
import java.util.Arrays;

public class q1 {

    // 计算曼哈顿距离
    private static int manhattanDist(int x1, int y1, int x2, int y2) {
        return Math.abs(x1 - x2) + Math.abs(y1 - y2);
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // 读取起始位置和目标位置
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();

        // 读取瓶子数量
        int n = scanner.nextInt();

        int[][] bottles = new int[n][2];
        for (int i = 0; i < n; i++) {
            bottles[i][0] = scanner.nextInt();
            bottles[i][1] = scanner.nextInt();
        }

        // 使用动态规划，保存状态压缩后的最小代价
        int[][] dp = new int[1 << n][n];
        for (int i = 0; i < (1 << n); i++) {
            Arrays.fill(dp[i], Integer.MAX_VALUE);
        }

        // 初始化dp状态，计算从起始位置到每个瓶子的代价
        for (int i = 0; i < n; i++) {
            dp[1 << i][i] = manhattanDist(a, b, bottles[i][0], bottles[i][1]);
        }

        // 遍历所有状态，计算所有可能的路径代价
        for (int mask = 1; mask < (1 << n); mask++) {
            for (int i = 0; i < n; i++) {
                if ((mask & (1 << i)) != 0) {
                    for (int j = 0; j < n; j++) {
                        if ((mask & (1 << j)) == 0) {
                            int newMask = mask | (1 << j);
                            dp[newMask][j] = Math.min(dp[newMask][j], dp[mask][i] + manhattanDist(bottles[i][0], bottles[i][1], bottles[j][0], bottles[j][1]));
                        }
                    }
                }
            }
        }

        // 找到最小的代价，最后再加上将最后一个瓶子移到目标位置的代价
        int result = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            result = Math.min(result, dp[(1 << n) - 1][i] + manhattanDist(bottles[i][0], bottles[i][1], c, d));
        }

        // 输出结果
        System.out.println(result);
        scanner.close();
    }
}
